package net.xepherx.ytdl;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;

public class VideoPanelFactory {
	static JPanel getPanel(Video video){
		JPanel main = new JPanel();
		main.setLayout(new BorderLayout());
		
		main.setPreferredSize(new Dimension(0,100));
		main.setMinimumSize(new Dimension(0,100));
		main.setBackground(new Color(0xcecece));
		
		JPanel image = new JPanel();
		
		image.setPreferredSize(new Dimension(133,100));
		image.setMinimumSize(image.getPreferredSize());
		image.setMaximumSize(image.getPreferredSize());
		
		image.setBackground(new Color(0xffffff));
		
		JLabel imageLabel = new JLabel();
		imageLabel.setIcon(new ImageIcon(video.getThumbnail()));
		
		image.add(imageLabel);
		
		JPanel rightpart = new JPanel();
		rightpart.setLayout(new BorderLayout());
		
		rightpart.setBackground(new Color(0xffffff));
		
		JProgressBar jpb = new JProgressBar();
		
		jpb.setPreferredSize(new Dimension(0,15));
		jpb.setValue(50);
		
		
		main.add(image, BorderLayout.LINE_START);
		main.add(rightpart, BorderLayout.CENTER);
		rightpart.add(jpb, BorderLayout.SOUTH);
		main.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(0xCBCBCB)));
		
		
		
		
		return main;
		
	}
	
	static JPanel getDummy(){
		JPanel t = new JPanel();
		t.setPreferredSize(new Dimension(0,100));
		t.setMinimumSize(new Dimension(0,100));
		
		return t;
		
		
	}
}
